﻿<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sf" uri="http://www.springframework.org/tags/form"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>齐重后台管理系统</title>
<link rel=stylesheet type=text/css
	href="<%=request.getContextPath()%>/resources/css/backstage/main.css" />
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/resources/js/base/jquery-ui.css"/>
<link rel="stylesheet" type="text/css"
	href="<%=request.getContextPath()%>/resources/css/admin/main.css" />
<script type="text/javascript"
	src="<%=request.getContextPath()%>/resources/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/resources/js/admin/inc.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/qzsk/js/clientlib-vendor.js"></script>
<link rel=stylesheet type=text/css
	href="<%=request.getContextPath()%>/resources/css/admin/product.css">
<LINK rel=stylesheet
	href="<%=request.getContextPath()%>/resources/css/admin/delCon.css">
<link rel=stylesheet type=text/css
	href="<%=request.getContextPath()%>/resources/css/backstage/back-nav.css">
<script type=text/javascript
	src="<%=request.getContextPath()%>/resources/js/backstage/back-nav.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/resources/js/ui/jquery.ui.core.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/resources/js/ui/jquery.ui.widget.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/resources/js/ui/jquery.ui.button.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/resources/js/ui/jquery.ui.spinner.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/resources/js/admin/paixu.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/dwr/engine.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/dwr/interface/dwrService.js"></script>
<style>
.box {
	width: 100%;
	height: 100px;
}

.pic-content {
	padding-left: 20px;
	padding-top: 10px;
	width: 860px;
	position: absolute;
	margin-left: 152px;
	float: left;
}

img {
	padding: 10px;
}
</style>
<script type="text/javascript">
	$(function() {
		$(".checkbox").click(function() {
			var id = $(this).attr('idv');
			if ($(this).is(':checked')) {
				dwrService.updateIndexImg(id, 1);
			} else {
				dwrService.updateIndexImg(id, 0);
			}
		});
		var _this = '';
		$(".delete").click(function() {
			_this = this;
			$('#mes').html('确定要删除吗?');
			$('.con-mes').fadeIn();
			$('.cover').css('display', 'block');
		});
		$(".update").click(function() {
			var id = $(this).attr('id');
			var path = $('#ctx').val();
			window.location.replace(path + '/admin/topic/updatePic/' + id+".do");
		});
		$('#con-mes').click(function() {
			var id = $(_this).attr('id');
			var path = $('#ctx').val();
			window.location.replace(path + '/admin/topic/delpic/' + id+".do");
		});
		$('#del-mes').click(function() {
			$('.con-mes').fadeOut();
			$('.cover').css('display', 'none');
		});
		$(document.body).limit();

		/*-----------------------------排序------------------------------  */
		$(".posCon").on("click", ".confirmPos", function(e) {
			e.preventDefault();
			var id = $(this).parent("span").prev("a").attr("picid");
			var op = $(this).parent("span").prev("a").attr("pos");
			var np = $(this).prev("input").val();
			if (op != np) {
				//通过dwr更新节点
				dwrService.updateProPos(id, op, np, function() {
					window.location.reload();
				});
			}
			$(this).parent("span").prev("a.setPos").on("click", setPos);
			$(this).parent("span").remove();
		});
	});
</script>
</head>
<body style='width: 100%;'>
<input type="hidden" id="maxPos" value="${maxPos }"/>
<input type="hidden" id="minPos" value="${minPos }"/>
	<jsp:include page="/jsp/admin/top.jsp"></jsp:include>
	<div class="content-box">
		<jsp:include page="/jsp/admin/nav.jsp"></jsp:include>
		<div id="content">
			<input type='hidden' value='<%=request.getContextPath()%>' id='ctx'>
			<div class="cover"></div>
			<div class="con-mes">
				<center>
					<span id='mes' style="padding-top: 20px; font-size: 18px;"></span>
				</center>
				<div style="margin: 0 auto; width: 150px;">
					<div id="con-mes">确定</div>
					<div id="del-mes">取消</div>
				</div>
			</div>
			<div class="inc">
				<jsp:include page="inc.jsp"></jsp:include>
			</div>
			<div class="box">
				<div class="pro-list">
					<ul>
						<c:forEach items="${product }" var="p">

							<li style="margin-top: 2px;"><a
								href="<%=request.getContextPath()%>/admin/topic/showPic/${p.id }.do"><c:choose>
										<c:when test="${p.id==proTypeId }">
											<span style="color: red">${p.name }</span>
										</c:when>
										<c:otherwise> ${p.name }</c:otherwise>
									</c:choose></a></li>
						</c:forEach>
					</ul>
				</div>

				<div class="pic-content">
					<div style="margin-top: -10px; position: absolute;">
						<jsp:include page="/jsp/pager.jsp">
							<jsp:param value="${proPic.total }" name="totalRecord" />
							<jsp:param value="${proPic.datas[0].proTypeId }.do" name="url" />
						</jsp:include>
					</div>
					<br />
					<div>
						<c:forEach items="${proPic.datas }" var="pic">
							<table width="215px" height="200px"
								style="float: left; background-color: #f6f6ff; word-break: break-all;">
								<tr>
									<td><div class="posCon">位置:${pic.proPos }&nbsp;<a href="#"
												class="list_opg setPos" pos="${pic.proPos }" picid="${pic.id }">排序</a>
										</div>
										<img
										src="<%=request.getContextPath()%>/resources/upload/${pic.newName }"
										width="215px" height="200px" alt="${pic.attName } "></td>

								</tr>
								<tr>
									<td><div limit='15'>${pic.attName }</div>
										<div class="bfont-box">
											<div class='bfont delete' id='${pic.id }'>删除</div>
											<div class='bfont update' id="${pic.id}">编辑</div>
											<div style="float: left; margin-top: 18px; margin-left: 5px;">
												<c:choose>
													<c:when test="${pic.isIndexPic==1}">
									推荐?<input type='checkbox' class='checkbox' idv='${pic.id }'
															checked="true">
													</c:when>
													<c:otherwise>
									推荐?<input type='checkbox' class='checkbox' idv='${pic.id }'>
													</c:otherwise>
												</c:choose>
											</div>
										</div></td>
								</tr>
							</table>
						</c:forEach>
					</div>

				</div>
			</div>
		</div>
</body>
</html>